<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../taglibs.jsp"%>
<%@ include file="../easyuiLib.jsp"%>
<%@page import="com.carnation.utils.MenuRead"%>
<%@page import="com.carnation.bean.GroupMenu"%>
<%
	MenuRead menuRead = new MenuRead();
	GroupMenu groupMenu = menuRead.getGroupMenuById(request
			.getParameter("id"));
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" charset="utf-8">
	function modify() {
		$('#modifyForm').form('submit', {
			url : '${ctx}/ModMenu',
			onSubmit : function() {
				return $('#modifyForm').form('validate');
			},
			success : function(data) {
				var json = JSON.parse(data);
				window.parent.refresh();
				$.messager.alert("结果", json.msg);
			}
		});
	}

	function create() {
		$('#createForm').form('submit', {
			url : '${ctx}/AddMenu',
			onSubmit : function() {
				return $('#createForm').form('validate');
			},
			success : function(data) {
				var json = JSON.parse(data);
				window.parent.refresh();
				$.messager.alert("结果", json.msg);
			}
		});
	}
	
</script>
</head>
<body>
	<div class="easyui-panel" style="overflow: hidden" title="组菜单"
		fit="true">
		<div>
			<table border="1" style="width: 100%; height: 100px;">
				<tr>
					<th>编号</th>
					<th>名称</th>
					<th>图标</th>
					<th>功能</th>
				</tr>
				<tr>
					<td><span><%=groupMenu.getId()%></span></td>
					<td><span><%=groupMenu.getName()%></span></td>
					<td><span><%=groupMenu.getIcon()%></span></td>
					<td><span>1.修改组菜单</span><br /><span>2.创建菜单</span><br /></td>
				</tr>
			</table>
		</div>
		<div class="easyui-panel" id="modifyPanel" title="修改组菜单">
			<form id="modifyForm" method="post" class="easyui-form">
				<table>
					<tr style="display: none;">
						<th><span>类型:</span></th>
						<td><input type="text" value="group" readonly="true"
							name="type" /></td>
					</tr>
					<tr style="display: none;">
						<th><span>编号:</span></th>
						<td><input type="text" value="<%=groupMenu.getId()%>"
							readonly="true" name="id" /></td>
					</tr>
					<tr>
						<th><span style="float:right">名称:</span></th>
						<td><input class="easyui-validatebox textbox" data-options="required:true" type="text" value="<%=groupMenu.getName()%>"
							name="name" /></td>
					</tr>
					<tr>
						<th><span style="float:right">图标:</span></th>
						<td><input class="easyui-validatebox textbox" data-options="required:true" type="text" value="<%=groupMenu.getIcon()%>"
							name="icon" /></td>
					</tr>
					<tr>
						<td></td>
						<td><a class="easyui-linkbutton" onclick="modify()">修改</a></td>
					</tr>
				</table>
			</form>
		</div>
		<div class="easyui-panel" id="addMenuPanel" title="创建子菜单">
			<form id="createForm" method="post" class="easyui-form">
				<table>
					<tr style="display: none;">
						<th><span>类型:</span></th>
						<td><input type="text" value="menu" name="type" /></td>
					</tr>
					<tr style="display: none;">
						<th><span>编号:</span></th>
						<td><input type="text" name="parentId"
							value="<%=groupMenu.getId()%>" /></td>
					</tr>
					<tr>
						<th><span>名称:</span></th>
						<td><input class="easyui-validatebox textbox" data-options="required:true" name="name" /></td>
					</tr>
					<tr>
						<th><span>图标:</span></th>
						<td><input class="easyui-validatebox textbox" data-options="required:true" value="icon-menu" name="icon" /></td>
					</tr>
					<tr style="display: none;">
						<th><span>URL：</span></th>
						<td><input type="text" name="url" /></td>
					</tr>
					<tr>
						<td></td>
						<td><a class="easyui-linkbutton" onclick="create()">创建</a></td>
					</tr>
				</table>
			</form>
		</div>
	</div>
</body>
</html>